
/**
 * 
 * GBC - A convenience class to tame the GridBagLayout
 * Copyright (C) 2002 Cay S. Horstmann (http://horstmann.com)
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package com.mephi.gui;


import java.awt.*;


/**
 * 
 * This class helps by using GridBagConstraints layout class
 * @since 2011-04-09
 */
public class GBC extends GridBagConstraints 
{
   
	/**
	 * 
	 * It creates GBC object for given parameters gridx and gridy
	 * @param gridx position gridx
     * @param gridy position gridy
	 */	
    public GBC(int gridx, int gridy)
    {
    	this.gridx = gridx;
    	this.gridy = gridy;
    }

    /**
     * 
     * It creates GBC object for given parameters gridx, gridy, gridwidth, gridheight.
     * The remaining has the default values
     * @param gridx position gridx
     * @param gridy position gridy
     * @param gridwidth of the cell in the x direction
     * @param gridheight of the cell in the x direction
     */
    public GBC(int gridx, int gridy, int gridwidth, int gridheight)
    {
    	this.gridx = gridx;
    	this.gridy = gridy;
    	this.gridwidth = gridwidth; 
    	this.gridheight = gridheight; 
    }

    /**
     * 
     * It configures anchor parameter.
     * @param anchor the anchor to set
     * @return GBC instance for the further modification
     */
    public GBC setAnchor(int anchor) 
    { 
    	this.anchor = anchor; 
    	return this;
    }

    /**
     * 
     * It configures anchor parameter.
     * @param fill the fill to set
     * @return GBC instance for the further modification
     */
    public GBC setFill(int fill) 
    { 
    	this.fill = fill; 
    	return this;
    }

    /**
     * 
     * It configures weightx and weighty parameters.
     * @param weightx the weightx to set
     * @param weighty the weighty to set
     * @return GBC instance for the further modification
     */
    public GBC setWeight(double weightx, double weighty) 
    { 
    	this.weightx = weightx; 
    	this.weighty = weighty; 
    	return this;
    }

    /**
     * 
     * It configures distance parameters.
     * @param distance the distance to set in all directions
     * @return GBC instance for the further modification
     */
    public GBC setInsets(int distance) 
    { 
    	this.insets = new Insets(distance, distance, distance, distance);
    	return this;
    }

    /**
     * 
     * It configures distance parameters.
     * @param top the top space to set
     * @param left the left space to set
     * @param bottom the bottom space to set
     * @param right the right space to set
     * @return GBC instance for the further modification
     */
    public GBC setInsets(int top, int left, int bottom, int right) 
    { 
    	this.insets = new Insets(top, left, bottom, right);
    	return this;
    }

    /**
     * 
     * It configures ipadx and ipady parameters.
     * @param ipadx the ipadx to set
     * @param ipady the ipady to set
     * @return GBC instance for the further modification
     */
    public GBC setIpad(int ipadx, int ipady) 
    { 
    	this.ipadx = ipadx; 
    	this.ipady = ipady; 
    	return this;
    }
   
    private static final long serialVersionUID = -9027164433184059929L;
}
